// This page acts as return url from the paypal back to the site


using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using SiteManager;
using System.Data.SqlClient;
using System.Text;

public partial class Doctor_CreditCard : System.Web.UI.Page
{
    Manager mgr = new Manager(true,"ConnectionString");
       
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString.HasKeys())
        {
            int msgid = Convert.ToInt32(Request.QueryString["id"]);
            if (msgid > 0)
            {
                // Transaction successful
                lbl_msg.Text = "Your Featured Doctor account has been successfully activated.<br/>Thank You.";

                //K:    THE BELOW WRITTEN CODE IS FREEZED TO STOP THE OUTBID PROCESS 
                //      10 NOVEMBER 2006

                // send mails to the doctors with 2nd highest bid regarding their bid has been outbid.
                
                // try
                 //{
                 //    SqlParameter[] sqlParam = new SqlParameter[1];
                 //    sqlParam[0] = new SqlParameter("@bid_id", SqlDbType.Int);
                 //    sqlParam[0].Value = msgid;

                 //    DataSet ds_outbid= mgr.ExecuteQuery("get_outbiddetails", sqlParam, "tbl");
                 //    if (ds_outbid.Tables[0].Rows.Count > 0)
                 //    {
                 //        // send mail here to the outbid doctors  
                 //        for (int i = 0; i < ds_outbid.Tables[0].Rows.Count; i++)
                 //        {
                 //            send_mail(ds_outbid.Tables[0].Rows[i]["fname"].ToString(), 
                 //                ds_outbid.Tables[0].Rows[i]["Email"].ToString(), 
                 //                ds_outbid.Tables[0].Rows[i]["maxbid"].ToString());
                 //        }
                 //    }
                 //    else
                 //    {
                 //        // no doctors outbid
                 //    }

                 //}
                 //catch (Exception ex)
                 //{
                 //    //throw;
                 //}
            }
            else
            {
                //Transaction failed.
                lbl_msg.Text = "Your Featured doctor account could not be activated .... Please try again.";
            }
        }
        else
        {
            //Transaction failed.
            lbl_msg.Text = "Your Featured doctor account could not be activated .... Please try again.";
        }
    }

     #region General Functions

    /// <summary>
    /// to send the oubid email to the doctors
    /// </summary>
    /// <param name="ds"></param>
    private void send_mail(string fname, string email, string maxbid)
    {
        StringBuilder str_body = new StringBuilder();
        str_body.Append("<br><b>Hello </b>" + fname + " <br><br> ");
        str_body.Append("Your bid has been outbid with a higher bid of amount : " + maxbid);
        str_body.Append("<br>Raise your bid to rank yourself higher in the results .<br><br>");

        str_body.Append("FindaDoc Support");
        mgr.sendMail(str_body.ToString(), email, "FindaDoc Support", "Your bid at FindaDoc has been outbid", "support@FindaDoc.com", "");
        //mgr.sendJMail(str_body.ToString(), email, "Your bid at FindaDoc has been outbid", "support@FindaDoc.com", "FindaDoc Support", "");
    }
    #endregion 
   
}
